package com.dingding.transfer.stamper.dto;

import cn.hutool.core.date.DateUtil;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;

import java.util.Date;

/**
 * @author wangxiyuan
 * @description 审批结束事件回调内容 参考https://developers.dingtalk.com/document/app/approval-events-1
 * @createDate 2021/3/30 13:50
 **/
@Data
public class TaskEndCallback {
    /** 事件类型*/
    private String EventType;

    /**审批实例id。*/
    private String processInstanceId;

    /**发生审批任务变更的企业。*/
    private String corpId;

    /**实例创建时间。*/
    @Getter(AccessLevel.NONE)
    private long createTime;

    @Getter(AccessLevel.NONE)
    private long finishTime;

    /**实例标题。*/
    private String title;

    /**审批任务结束类型：*/
    private String type;

    /**审批人id。*/
    private String staffId;

    /** agree：同意 refuse：拒绝*/
    private String result;

    /** 表示操作时写的评论内容。*/
    private String remark;

    /**审批模板的唯一码*/
    private String processCode;

    private String businessId;

    private String bizCategoryId;

    public String getCreateTime() {
        return DateUtil.format(DateUtil.date(this.createTime),"yyyy-MM-dd HH:mm:ss");
    }

    public String getFinishTime() {
        return DateUtil.format(DateUtil.date(this.finishTime),"yyyy-MM-dd HH:mm:ss");
    }

    public static void main(String[] args) {
        System.out.println(DateUtil.format(DateUtil.date(1617082983000l),"yyyy-MM-dd HH:mm:ss"));
        System.out.println(  DateUtil.formatBetween(1617082983000l));
    }
}
